from django.db import models

from myuser.models import MyUser
from prj004.models.models import CreateTimeModel
from prj004.models.info import Info


class Result(CreateTimeModel):
    owner = models.ForeignKey(MyUser, on_delete=models.CASCADE, related_name='prj004_result')

    info = models.OneToOneField(Info, related_name='result', on_delete=models.CASCADE)

    jinqi_cure = models.BooleanField(default=False, blank=True, verbose_name='近期疗效-再次妊娠超过既往流产最长孕周', help_text='近期疗效-再次妊娠超过既往流产最长孕周')

    yuanqi_zu = models.BooleanField(default=False, blank=True, verbose_name='远期疗效-足月分娩（活婴获得）', help_text='远期疗效-足月分娩（活婴获得）')

    yuanqi_apgar = models.IntegerField(null=True, blank=True, verbose_name='远期疗效-新生儿Apgar评分', help_text='远期疗效-新生儿Apgar评分')

    def __str__(self):
        return '{}-{}'.format(self.owner, self.info)

    class Meta:
        verbose_name = '疗效'
        verbose_name_plural = verbose_name
